<?php
require_once('lib.php');
require_once('form.php');

// получение параметров
$dtype = optional_param('dtype', '', PARAM_TEXT);

// ограничение доступа 
require_capability('tool/cleanup:access', get_context_instance(CONTEXT_SYSTEM));

if ( $dtype == 'files' OR $dtype == 'users')
{// пришел валидный параметр - создаем форму
    $url = new moodle_url($CFG->wwwroot."/admin/tool/cleanup/delete.php");
    $customdata = new stdClass();
    $customdata->dtype = $dtype;
    $form = new tool_cleanup_delete_data_form($url->out(), $customdata);
}

// печать шапки
admin_externalpage_setup('toolcleanup');
echo $OUTPUT->header();

echo "<h4>".get_string('available_actions_list','tool_cleanup').":</h4>";
echo "<ul><li><a href='".$CFG->wwwroot."/admin/tool/cleanup/index.php?dtype=files"
    ."'>".get_string('delete_files','tool_cleanup')."</a></li>";

echo "<li><a href='".$CFG->wwwroot."/admin/tool/cleanup/index.php?dtype=users"
    ."'>".get_string('delete_inactive_users','tool_cleanup')."</a></li></ul>";

if (isset($form))
{
    $form->display();
}

echo $OUTPUT->footer();
?>